﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="listmenu.ascx.cs" Inherits="controls_admin_listmenu" %>
<div id="content">        
    <!-- new box --> 
    	<div class="box corners shadow">
            <div class="box-header">
                <img src="../templates/admin/images/icon_menu.png" /><h2>Danh mục</h2>
                <div class="box-header-ctrls">	
                	<a href="javascript:void(null);" title="" class="close"><!-- --></a>
                </div>
            </div>                
            <div class="box-content" id="contacts-1a">
               <div class="inbox-sf">                                                           
                    <div class="form-msg-good-advanced" runat="server" id="msgSuccess" style="display:none; float:left; margin-left:20px; margin-bottom:20px; width:220px;"></div>
                    <asp:Button ID="btnThem" runat="server" Text="Thêm" 
                        class="inbox-sf-add-btn tip" title="Thêm danh mục mới" onclick="btnThem_Click" 
                         />                          
                </div>                                                           
                <table style="width:100%" >                    
                    <asp:Repeater ID="rptDanhMucCha" runat="server" 
                        > 
                        <HeaderTemplate>
                	        <thead class="contacts-head-1"> 
                                <tr> 
                                    <th class="contacts-head-1-select" style="width:2%"><asp:CheckBox ID="CheckSelectAll" runat="server"/></th>
                                    <th class="contacts-head-1-id" style="width:4%">STT</th>
                                    <th class="contacts-head-1-name" style="width:30%">Tên danh mục</th>
                                    <th class="contacts-head-1-name" style="width:10%">Sắp xếp</th>
                                    <th class="contacts-head-1-name" style="width:15%">Vị trí hiển thị</th>
                                    <th class="contacts-head-1-role" style="width:9%">Danh mục cấp</th>                                                        
                                    <th class="contacts-head-1-date" style="width:10%">Trạng thái</th>
                                    <th class="contacts-head-1-actions" style="width:7%">Thao tác</th>                        
                                </tr> 
                            </thead>
                           <tbody class="contacts-content-1">
                        </HeaderTemplate> 
                        <ItemTemplate>                                                                                
                                <tr> 
                                    <td class="contacts-content-1-select" style="width:2%">
                                        <asp:Literal ID="ltId" Visible="false" runat="server" Text='<%# Eval("Id") %>'></asp:Literal>
                                        <asp:CheckBox ID="CheckSelect" runat="server"/>
                                    </td>
                                    <td class="contacts-content-1-id" style="width:4%"><%= stt++%></td>
                                    <td class="contacts-content-1-name" style="width:30%"><%# Eval("Ten")%></td>
                                    <td class="contacts-content-1-name" style="width:10%">
                                        <asp:TextBox ID="txtSapXep" runat="server" Text='<%# Eval("SapXep")%>' class="input_other"></asp:TextBox>
                                    </td>
                                    <td class="contacts-content-1-role" style="width:15%"><%# (Boolean.Parse(Eval("Tren").ToString())==true)?" Trên":""%>
                                                                                          <%# (Boolean.Parse(Eval("Trai").ToString())==true)?" Trái":""%>
                                                                                          <%# (Boolean.Parse(Eval("Phai").ToString())==true)?" Phải":""%>
                                                                                          <%# (Boolean.Parse(Eval("Duoi").ToString())==true)?" Dưới":""%>
                                                                                          <%# (Boolean.Parse(Eval("TinTuc").ToString())==true)?" Tin tức":""%></td>
                                    <td class="contacts-content-1-email" style="width:9%"><%# Eval("Cap")%></td>
                                    <td class="contacts-content-1-date" style="width:10%"><%# (Boolean.Parse(Eval("TrangThai").ToString()) == true)?"Hiển thị":"Không hiển thị"%></td>                            
                                    <td class="contacts-content-1-actions" style="width:7%">
                                        <asp:HyperLink ID="hlSua" runat="server" class="edit-contact gradient-btn" NavigateUrl='<%# "~/admin/addmenu.aspx?action=edit&info=" + Eval("Id") %>'>Sửa</asp:HyperLink>
                                        <asp:HyperLink ID="lbXoa" runat="server" onclick="return confirm(' Sau khi xóa không thể phục hồi! Chắc chắn rằng bạn muốn xóa danh mục này?');" class="delete-contact gradient-btn" NavigateUrl='<%# "~/admin/addmenu.aspx?action=delete&info=" + Eval("Id") %>'>Xóa</asp:HyperLink>
                                    </td>                        
                                </tr>  
                            <asp:Repeater ID="rptDanhMucCon1" runat="server">
                                <ItemTemplate>
                                    <tr> 
                                        <td class="contacts-content-1-select" style="width:2%">
                                            <asp:Literal ID="ltId" Text='<%# Eval("Id") %>' Visible="false" runat="server"></asp:Literal>                                            
                                        </td>
                                        <td class="contacts-content-1-id" style="width:4%"><%= stt++%></td>
                                        <td class="contacts-content-1-name" style="width:30%"><div style="margin-left:20px"><img src="../templates/admin/images/tree_view.png" style="margin-right:10px;" alt="tree" /><%# Eval("Ten")%></div></td>
                                        <td class="contacts-content-1-name" style="width:10%">
                                            <asp:TextBox ID="txtSapXep" runat="server" Text='<%# Eval("SapXep")%>' style="width:80px; margin-left:30px;" class="input_other"></asp:TextBox>
                                        </td>
                                        <td class="contacts-content-1-role" style="width:15%"><%# (Boolean.Parse(Eval("Tren").ToString())==true)?" Trên":""%>
                                                                                          <%# (Boolean.Parse(Eval("Trai").ToString())==true)?" Trái":""%>
                                                                                          <%# (Boolean.Parse(Eval("Phai").ToString())==true)?" Phải":""%>
                                                                                          <%# (Boolean.Parse(Eval("Duoi").ToString())==true)?" Dưới":""%>
                                                                                          <%# (Boolean.Parse(Eval("TinTuc").ToString())==true)?" Tin tức":""%></td>
                                        <td class="contacts-content-1-email" style="width:9%"><div style="margin-left:20px"><%# Eval("Cap")%></div></td>
                                        <td class="contacts-content-1-date" style="width:10%"><%# (Boolean.Parse(Eval("TrangThai").ToString()) == true)?"Hiển thị":"Không hiển thị"%></td>                            
                                        <td class="contacts-content-1-actions" style="width:7%">
                                            <asp:HyperLink ID="hlSua" runat="server" class="edit-contact gradient-btn" NavigateUrl='<%# "~/admin/addmenu.aspx?action=edit&info=" + Eval("Id") %>'>Sửa</asp:HyperLink>
                                            <asp:HyperLink ID="lbXoa" runat="server" onclick="return confirm('Sau khi xóa không thể phục hồi! Chắc chắn rằng bạn muốn xóa danh mục này?');" class="delete-contact gradient-btn" NavigateUrl='<%# "~/admin/addmenu.aspx?action=delete&info=" + Eval("Id") %>'>Xóa</asp:HyperLink>                                                                                
                                        </td>                        
                                    </tr>
                                    <asp:Repeater ID="rptDanhMucCon2" runat="server">
                                    <ItemTemplate>
                                        <tr> 
                                            <td class="contacts-content-1-select" style="width:2%">
                                                <asp:Literal ID="ltId" Text='<%# Eval("Id") %>' Visible="false" runat="server"></asp:Literal>                                                
                                            </td>
                                            <td class="contacts-content-1-id" style="width:4%"><%= stt++%></td>
                                            <td class="contacts-content-1-name" style="width:30%"><div style="margin-left:80px"><img src="../templates/admin/images/tree_view.png" style="margin-right:10px;" alt="tree" /><%# Eval("Ten")%></div></td>
                                            <td class="contacts-content-1-name" style="width:10%">
                                                <asp:TextBox ID="txtSapXep" runat="server" Text='<%# Eval("SapXep")%>' style="width:50px; margin-left:60px;" class="input_other"></asp:TextBox>
                                            </td>
                                            <td class="contacts-content-1-role" style="width:15%"><%# (Boolean.Parse(Eval("Tren").ToString())==true)?" Trên":""%>
                                                                                          <%# (Boolean.Parse(Eval("Trai").ToString())==true)?" Trái":""%>
                                                                                          <%# (Boolean.Parse(Eval("Phai").ToString())==true)?" Phải":""%>
                                                                                          <%# (Boolean.Parse(Eval("Duoi").ToString())==true)?" Dưới":""%>
                                                                                          <%# (Boolean.Parse(Eval("TinTuc").ToString())==true)?" Tin tức":""%></td>
                                            <td class="contacts-content-1-email" style="width:9%"><div style="margin-left:40px"><%# Eval("Cap")%></div></td>
                                            <td class="contacts-content-1-date" style="width:10%"><%# (Boolean.Parse(Eval("TrangThai").ToString()) == true)?"Hiển thị":"Không hiển thị"%></td>                            
                                            <td class="contacts-content-1-actions" style="width:7%">
                                                <asp:HyperLink ID="hlSua" runat="server" class="edit-contact gradient-btn" NavigateUrl='<%# "~/admin/addmenu.aspx?action=edit&info=" + Eval("Id") %>'>Sửa</asp:HyperLink>
                                                <asp:HyperLink ID="lbXoa" runat="server" onclick="return confirm('Sau khi xóa không thể phục hồi! Chắc chắn rằng bạn muốn xóa danh mục này?');" class="delete-contact gradient-btn" NavigateUrl='<%# "~/admin/addmenu.aspx?action=delete&info=" + Eval("Id") %>'>Xóa</asp:HyperLink>
                                            </td>                        
                                        </tr>
                                    </ItemTemplate>
                                </asp:Repeater> 
                                </ItemTemplate>
                            </asp:Repeater>                                                                                                                                                                                                                                                                              
                        </ItemTemplate>
                        <FooterTemplate></tbody></FooterTemplate>
                    </asp:Repeater>                                        
                </table>
                <div class="form-msg-warning-advanced" runat="server" id="msgSearch" style="display:none; float:left; margin-left:0px; margin-bottom:20px; width:220px;">Không có kết quả như yêu cầu tìm kiếm!</div>
                <div class="form-msg-warning-advanced" runat="server" id="msgNoRows" style="display:none; float:left; margin-left:0px; margin-bottom:20px; width:200px;">Dữ liệu đang cập nhật...</div>
                <div class="box-bt-bar">                                                                                  
                    <div class="bulk-actions">                       
                        <asp:Button ID="btnSapXep" runat="server" Text="Sắp xếp" onclick="btnSapXep_Click"  />
                        <asp:Button ID="btnXoa" runat="server" Text="Xóa" onclick="btnXoa_Click"  />
                        <asp:Button ID="btnLamMoi" runat="server" Text="Làm mới" 
                             />                        
                    </div> 
                </div>                 
            </div>            
        </div>                                                                       
</div>
<script type="text/javascript" src="../templates/admin/scripts/checkAll.js"></script>
<script type="text/javascript">
    var rptDanhMucChaControl = document.getElementById('<%= rptDanhMucCha.ClientID %>');
    $('input:checkbox[id$=CheckSelectAll]', rptDanhMucChaControl).click(function(e)
    {
        if (this.checked)
        {
            $('input:checkbox[id$=CheckSelect]', rptDanhMucChaControl).attr('checked', true);
        }
        else
        {
            $('input:checkbox[id$=CheckSelect]', rptDanhMucChaControl).removeAttr('checked');
        }
    });
   
    $('input:checkbox[id$=CheckSelect]', rptDanhMucChaControl).click(function(e)
    {
        //Bo checkall
        if ($('input:checkbox[id$=CheckSelect]:checked', rptDanhMucChaControl).length == 0)
        {
            $('input:checkbox[id$=CheckSelectAll]', rptDanhMucChaControl).removeAttr('checked');
        }
        // Checkall
        else if ($('input:checkbox[id$=CheckSelect]:checked', rptDanhMucChaControl).length == $('input:checkbox[id$=CheckSelect]', rptDanhSachThanhVienControl).length)
        {
            $('input:checkbox[id$=CheckSelectAll]', rptDanhMucChaControl).attr('checked', true);
        }
    });

</script>

